import { Shop } from './shop.entity'
import { Column, ManyToOne, JoinTable, Entity, PrimaryGeneratedColumn } from 'typeorm'
import { Member } from '../member'
// 订单
@Entity()
export class ShopOrder {
  @PrimaryGeneratedColumn()
  id: number

  @Column({
    comment: '订单编号'
  })
  tid: string

  @Column({
    comment: '订单费用'
  })
  fee: string

  /**
   * 一个订单有一个会员
   */
  @ManyToOne(type => Member, member => member.orders, { cascade: true })
  @JoinTable()
  member: Member

  /**
   * 一个订单有一个店铺
   */
  @ManyToOne(type => Shop, shop => shop.orders, { cascade: true })
  @JoinTable()
  shop: Shop
}
